/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class CreatePinpassData {
	public void createTestData() throws PersistentException {
		PersistentTransaction t = orm.PinpassPersistentManager.instance().getSession().beginTransaction();
		try {
			orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
			orm.dao.CoordenadaDAO lormCoordenadaDAO = lDAOFactory.getCoordenadaDAO();
			orm.Coordenada lormCoordenada = lormCoordenadaDAO.createCoordenada();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tarjeta_idtarjeta, valor
			lormCoordenadaDAO.save(lormCoordenada);
			orm.dao.TarjetaDAO lormTarjetaDAO = lDAOFactory.getTarjetaDAO();
			orm.Tarjeta lormTarjeta = lormTarjetaDAO.createTarjeta();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : coordenada, cliente_idcliente, cod
			lormTarjetaDAO.save(lormTarjeta);
			orm.dao.ClienteDAO lormClienteDAO = lDAOFactory.getClienteDAO();
			orm.Cliente lormCliente = lormClienteDAO.createCliente();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tarjeta, password, rut, nombre
			lormClienteDAO.save(lormCliente);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			CreatePinpassData createPinpassData = new CreatePinpassData();
			try {
				createPinpassData.createTestData();
			}
			finally {
				orm.PinpassPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
